//
//  FPTopClassViewCell.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/14.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPTopClassViewCell.h"

@implementation FPTopClassViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
   
   
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        CGFloat LRSpace = 25;
        CGFloat centreSpace = 50;
        CGFloat imageViewW = (kScreenWidth - 2 * kImageH(LRSpace) - 2 * kImageH(centreSpace)) / 3 ;
        self.sunView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth/3)];
        self.sunView.userInteractionEnabled = YES;
       
        [self.contentView addSubview:_sunView];
        self.leftImageView = [[UIImageView alloc]initWithFrame:CGRectMake(kImageH(LRSpace), kImageH(20), imageViewW, imageViewW)];
        self.leftImageView.backgroundColor = [UIColor redColor];
    
        self.leftImageView.layer.cornerRadius = self.leftImageView.bounds.size.height/2;
        self.leftImageView.image = [UIImage imageNamed:@"sun"];
        self.leftImageView.userInteractionEnabled = YES;
        self.leftImageView.layer.masksToBounds = YES;
    
        [self.sunView addSubview:_leftImageView];
        //
        self.leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(0,self.leftImageView.y + self.leftImageView.height, kScreenWidth / 3, 20)];
        self.leftLabel.font = [UIFont systemFontOfSize:12];
        self.leftLabel.textAlignment = NSTextAlignmentCenter;
    //    self.leftLabel.text = @"时光Top100";
        [self.sunView addSubview:_leftLabel];
        
        
        
        //添加中间
        self.centreImageView = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenWidth/3 + kImageH(LRSpace), kImageH(20), imageViewW, imageViewW)];
        self.centreImageView.image = [UIImage imageNamed:@"china"];
          self.centreImageView.userInteractionEnabled = YES;
        self.centreImageView.backgroundColor = [UIColor redColor];
        self.centreImageView.layer.cornerRadius = self.centreImageView.bounds.size.height/2;
        self.centreImageView.layer.masksToBounds = YES;
        [self.sunView addSubview:_centreImageView];
        self.centreLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth / 3,self.leftImageView.y + self.leftImageView.height, kScreenWidth / 3, 20)];
        self.centreLabel.font = [UIFont systemFontOfSize:12];
        self.centreLabel.textAlignment = NSTextAlignmentCenter;
    //    self.centreLabel.text = @"华语Top100";
        [self.sunView addSubview:_centreLabel];
        
        //添加右边
     
        self.rightImageView = [[UIImageView alloc]initWithFrame:CGRectMake(2 * kScreenWidth/3 + kImageH(LRSpace), kImageH(20), imageViewW, imageViewW)];
        self.rightImageView.backgroundColor = [UIColor redColor];
        self.rightImageView.image = [UIImage imageNamed:@"global.jpg"];

          self.rightImageView.userInteractionEnabled = YES;
        self.rightImageView.layer.cornerRadius = self.centreImageView.bounds.size.height/2;
        self.rightImageView.layer.masksToBounds = YES;
        [self.sunView addSubview:_rightImageView];
        self.rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(2 * kScreenWidth / 3,self.leftImageView.y + self.leftImageView.height, kScreenWidth / 3, 20)];
        self.rightLabel.font = [UIFont systemFontOfSize:12];
        self.rightLabel.textAlignment = NSTextAlignmentCenter;
      //  self.rightLabel.text = @"华语Top100";
        [self.sunView addSubview:_rightLabel];

        self.labelArray = @[_leftLabel,_centreLabel,_rightLabel];

    }
    return self;
}

- (void)cellForModel:(NSArray *)array
{
    for (int i = 0; i< array.count; i ++) {
        FPTopClass *model = array[i];
        UILabel *label = self.labelArray[i];
        label.text = model.title;
    }

}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
